{template 'common/header'}
<style>
	.main{
		margin: 0 0 30px 0;
	}
</style>
<ul class="nav nav-tabs">
	<li {if $operation == 'index'}class="active"{/if}><a href="{php echo $this->createWebUrl('bank', array('op' => 'index'))}">线下贷款申请管理</a></li>
</ul>
{if $operation == 'index'}
<div class="main">
    <div class="panel panel-default">
        <div class="table-responsive panel-body">
            <form action="" method="post" class="form-horizontal form" onsubmit="return formcheck(this)">
                <table class="table table-hover" style="margin-top: 15px;">
                    <thead class="navbar-inner">
                    <tr>
                        <th class="text-center">姓名</th>
                        <th class="text-center">推荐人</th>
                        <th class="text-center">联系电话</th>
                        <th class="text-center">身份证号码</th>
                        <th class="text-center">家庭住址</th>
                        <th class="text-center">工作单位</th>
                        <th class="text-center">需求额度</th>
                        <th class="text-center">工资发放形式</th>
                        <th class="text-center">是否有房</th>
                        <th class="text-center">是否有车</th>
                        <th class="text-center">是否有保单</th>
                        <th class="text-right">操作</th>
                    </tr>
                    </thead>
                    <tbody id="level-list">
                    {loop $list $row}
                    <tr>
						<td class="text-center">{$row['name']}</td>
                        <td class="text-center">{$row['recommend']}</td>
                        <td class="text-center">{$row['phone']}</td>
                        <td class="text-center">{$row['card']}</td>
                        <td class="text-center">{$row['address']}</td>
                        <td class="text-center">{$row['work']}</td>
                        <td class="text-center">{$row['quota']}</td>
                        <td class="text-center">{if $row['wages']==1}打卡{else}现金{/if}</td>
                        <td class="text-center">{if $row['room']==1}无{else}有{/if}</td>
                        <td class="text-center">{if $row['vehicle']==1}无{else}有{/if}</td>
                        <td class="text-center">{if $row['policy']==1}无{else}有{/if}</td>
                        <td class="text-center">
                            <a class="btn btn-default btn-sm" onclick="return confirm('是否要删除？');return false;" href="{php echo $this->createWebUrl('loan', array('op' => 'delete', 'id' => $row['id']))}" title="删除"><i class="fa fa-times"></i></a>
                            {if $row['status'] ==1}
                                <a class="btn btn-success btn-sm" href="{php echo $this->createWebUrl('netloan', array('op' => 'confirm', 'id' => $row['id']))}" title="通过"><i class="fa fa-check"></i></a>
                            {/if}
                            {if $row['status']==1&&$row['status']!=3}
                            <a class="btn btn-warning btn-sm" href="{php echo $this->createWebUrl('record', array('op' => 'reject', 'id' => $row['id']))}" title="驳回"><i class="fa fa-reply"></i></a>
                            {/if}
                            {if  $row['status']==3}
                                -----
                            {/if}
                        </td>
                    </tr>
                    {/loop}
                    <tr>
                        <td colspan="5">
                            <input type="hidden" name="token" value="{$_W['token']}"/>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </form>
        </div>
    </div>
    {$pager}

</div>
</div>
{elseif $operation == 'post'}
<div class="main">
	<form action="" method="post" class="form-horizontal form" >
    <div class="panel panel-default">
        <div class="panel-heading">银行接口 </div>
        <div class="panel-body">   
            <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">银行名称</label>
                <div class="col-sm-9">
                    <input type="text" name="data[name]" class="form-control names" value="{$item['name']}" />
                </div>
            </div>
             <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">分成金额</label>
                <div class="col-sm-9">
                    <input type="number" name="data[price]" class="form-control price" value="{$item['price']}" />
                </div>
            </div>   
<!-- 			<div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">接口地址</label>
                <div class="col-sm-9">
                    <input type="text" name="data[api]" class="form-control" value="{$item['api']}" />
                </div>
            </div> -->
            
            <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">银行图标</label>
                <div class="col-sm-9">
            		{php echo tpl_form_field_image('data[icon]',$item['icon'], '/web/resource/images/nopic.jpg', array('width' => 96, 'height' => 96))}
                    <span class="help-block" style="color:#f00">建议尺寸96*96的PNG格式银行标志</span>
                </div>
            </div>
            
            <div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">示例图片</label>
                <div class="col-sm-9">
            		{php echo tpl_form_field_image('data[photo]',$item['photo'], '/web/resource/images/nopic.jpg', array('width' => 600, 'height' => 300))}
                    <span class="help-block" style="color:#f00">建议尺寸600*300的信用卡图</span>
                </div>
            </div>
			<div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">查询网址</label>
                <div class="col-sm-9">
                    <input type="text" name="data[url]" class="form-control url" value="{$item['url']}" />
					<div class="help-block">办卡进度查询的网址</div>
                </div>
            </div>

			<div class="form-group">
                <label class="col-xs-12 col-sm-3 col-md-2 control-label">排列顺序</label>
                <div class="col-sm-9">
                    <input type="number" name="data[orderby]" class="form-control orderby" value="{$item['orderby']}" />
					<div class="help-block">数字越小越靠前</div>
                </div>
            </div>
        </div>
    </div>
    <div class="form-group">
        <div class="col-sm-12">
            <input name="submit" type="submit" value="提交" class="btn btn-primary ">
            <input type="hidden" name="token" value="{$_W['token']}"/>
			<input type="hidden" name="id" value="{$item['id']}"/>
        </div>
    </div>
	</form>
</div>
<script>
require(['jquery', 'util'], function($, util){
    $(function(){
        $('form').submit(function(){
           var name=$(".names").val();
            if(name==''||name==null){
                util.message('请填写银行名称');
                return false;
            }
           var price=$(".price").val();
            if(price==''||price==null){
                util.message('请填写分成金额');
                return false;
            }
            var url=$(".url").val();
            if(url==''||url==null){
                util.message('请填写查询网址');
                return false;
            }
            var orderby=$(".orderby").val();
            if(orderby==''||orderby==null){
                util.message('请填写查询网址');
                return false;
            }
        });

    });

});

</script>

{/if}


{template 'common/footer'}